package com.zhuxulin.java.email.busness;

import org.apache.commons.mail.EmailException;

import com.zhuxulin.java.email.fildder.LineHandler;
import com.zhuxulin.java.email.mail.SendSimpleEmail;
import com.zhuxulin.java.email.mail.bean.SimpleEmailMessage;
import com.zhuxulin.java.email.utils.ReadFileUtil;

/**
 * PhotoBlocker推销工具
 * 
 * @author ZhuXulin
 * 
 */
public class PhotoBlock {
	/**延迟发送时*/
	private static final int delay=30;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		/** Fildder抓包导出的附近的人列表 */
		String fileName = "C:\\Users\\Hacker\\Desktop\\11_Full.txt";
		/** 要发送的邮件内容 */
		String textName = "C:\\Users\\Hacker\\Desktop\\mail.txt";
		LineHandler hanlder = new LineHandler();
		ReadFileUtil.readFileByLines(fileName, hanlder);
		int i = 1;
		for (String s : hanlder.getAsQQMailList()) {
			System.out.println("num:" + i + "     " + s);
			i++;
			try {
				SendSimpleEmail.getInstance().sendMail(
						new SimpleEmailMessage("汽车车牌防拍照", "有车一族，幸福自由", ReadFileUtil.readTextFile(textName, "GBK"), s, delay));
			} catch (EmailException e) {
				e.printStackTrace();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		System.out.println("Total:" + i);
	}

}
